An efficient and accurate 2D human pose estimation method using VTTransPose network

Human pose estimation is a crucial area of study in computer vision. Transformer-based pose estimation algorithms have gained popularity for their excellent performance and relatively compact parameterization. However, these algorithms often face challenges including high computational demands and insensitivity to local details. To address these problems, the Twin attention module was introduced in TransPose to improve model efficiency and reduce resource consumption. Additionally, to address issues related to insufficient joint feature representation and poor network recognition performance, the enhanced TransPose model, named VTTransPose, replaced the basic block in the third subnet with the intra-level feature fusion module V block. The performance of the proposed VTTransPose model was validated on the public datasets COCO val2017 and COCO test-dev2017. The experimental results on COCO val2017 and COCO test-dev2017 indicate that the AP evaluation index scores of the VTTransPose network proposed are 76.5 and 73.6 respectively, marking improvements of 0.4 and 0.2 over the original TransPose network. Additionally, VTTransPose exhibited a reduction of 4.8G FLOPs, 2M parameters, and approximately 40% lower memory usage during training compared to the original TransPose model. All the experimental results demonstrate that the proposed VTTransPose is more accurate, efficient, and lightweight compared to the original TransPose model.

The above CNN-based methods are characterized by the ability to learn features at different scales through cascade structure, which facilitates the model to learn discriminative information on different semantic spaces.However, it is also because such methods need to continuously superimpose the network depth to gradually increase the receptive field and obtain the global feature information, which leads to the network becoming bulkier and heavier.To alleviate these problems, researchers have focused on the transformer architecture in the field of natural language processing.The core concept of the Transformer model lies in its reliance on attention mechanisms to entirely capture dependency relationships within input sequences, thereby eschewing the use of recurrent neural networks (RNNs) or convolutional neural networks (CNNs).Transformer-based models achieve this by requiring only a single self-attention layer to learn associations between any pair of features, thus enabling the modeling of relationships from local features to global context with a reduced parameter count.Moreover, it learns more about the interconnections between different features, not only relying on the data itself, which has better generalizability.Inspired by the success of transformer structures in other vision tasks [10][11][12][13] , a variety of different visual transformer structures have been successfully used for pose estimation.Based on a cascaded regression mechanism, Li and his colleagues 14 proposed a PRTR-based pose estimation network that uses an encoder-decoder structure to progressively predict human keypoints.To enhance the feature representation capability of the network for the highly fine-grained task of pose estimation, Yuan et al. 15 proposed an HRFormer to adapt the pose estimation task by introducing high-resolution representation into the visual transformer through a multi-resolution parallel transformer module.Different from the pure Transformer architecture, both TokenPose and TransPose human pose estimation models proposed by Li et al. 16 from Tsinghua University and the group led by Yang from Southeast University 17 respectively, utilize visual transformers to refine features extracted by CNN, thereby complementing the two network architectures.Ye et al. proposed the DistilPose model, which bridges the gap between heatmap-based and regression-based methods, transferring models based on heatmaps to models based on regression, effectively balancing speed and accuracy 18 .Cheng et al. introduced GTPose, which integrates Transformer and graph convolutional networks, establishing a topological relationship model between keypoints, learning feature representations, and achieving precise keypoint localization 19 .Among these, the TransPose human pose estimation network model organically combines CNN's excellent handling of local features with the Transformer's excellent modeling capability for global features.Introducing the Transformer into human pose estimation not only excellently accomplishes the pose estimation task but also reveals how the self-attention mechanism captures the global relationship between various joints of the human body.This CNN-transformer hybrid architecture provides a new solution approach for pose estimation tasks, demonstrating excellent performance both in pose estimation effectiveness on datasets like MS COCO 20 and MPII 21 , as well as in interpretability.
Nevertheless, insufficiencies still exist in this approach.First, the extensive feature maps in the pose estimation task and the inherent nature of the self-attention computing mechanism will impose heavy computational costs and consume large computational resources.Second, the scale of human joints varies greatly, and this CNN-transformer architecture is not sufficient to make a delicate local representation of joints at various scales.To address the above problems, this paper proposes an improved pose estimation algorithm called VTTransPose based on TransPose.
The contribution of this work can be summarized as follows.
Firstly, to alleviate the problem of large consumption of time and computational resources in human pose estimation tasks due to the extensive feature map, and the inherent characteristics of the self-attention mechanism.In this paper, we propose to introduce twin attention from SOTR 22 into TransPose and replace the selfattention mechanism in the original encoder layer to significantly reduce memory consumption and thus improve network efficiency.In addition, in order to enhance the special extraction capability without introducing more operations.In this paper, two 3 × 3 depthwise separable convolutions connected by leaky ReLU 23 are introduced after the twin attention of each transformer encoder layer as a useful complement to the attention mechanism to enhance the representation of joint features.
Secondly, to address the issue of scale differences in the original network, which hindered the precise localization of keypoints for body joints with significant scale variations, this paper was inspired by RSN 24 and designed a local feature enhancement module called the V block.It features a parallel multi-branch structure to fuse features with the same spatial size, thereby obtaining refined local features and enhancing the network's ability to localize keypoints.
The pose estimation effect of VTTranspose was tested on the COCO data set, and the AP (Average precision) of COCO val2017 and COCO test-dev2017 was 76.5AP and 73.6AP, respectively.Compared with the original Transpose network improved by 0.4 and 0.2.In addition, compared to the original network, VTTranspose's floating point operations (FLOPs) are reduced by 4.8G, the number of parameters is reduced by 2M, and the video memory occupancy during training is reduced by about 40%.Compared with other SOTA methods, VTTranspose proposed in this paper has a competitive performance.
The following paper is organized as follows: In "Method", the Method part will first give a brief description of the overall structure of VTTranspose.Later, the two improved modules of Twin attention, improved transformer encoder layer, and Backbone after the introduction of the V block will be explained in detail.In "Experimental and result analysis", the experimental and result analysis section will validate the VTTransPose algorithm developed in this paper on the COCO dataset and compare it with other excellent pose estimation algorithms.In "Conclusion", the conclusion section will summarize the algorithm of this paper and give an outlook on future research.

Method VTTransPose network structure
The VTTransPose network architecture proposed in this paper is an improvement upon the TransPose model 17 .
TransPose is a detection model that introduces Transformer principles into human pose estimation.The model mainly consists of three parts: a backbone network for extracting mid-level human pose features from input images, a transformer encoder for modeling global relationships among the joint features output by the backbone network, and a head for predicting the positions of human keypoints.The structure of VTTranspose is illustrated in Fig. 1.
Take a human body pose image I ∈ R 3×H I ×W I as an example.Feed it into the VTTranspose network.After Backbone processing, the low and middle-level feature maps of human joints based on this image are output, whose mathematical characterization method is X f ∈ R d×H×W , and the channel dimension has been changed to d through the 1 × 1 convolution.Then, the image feature map is flattened into a sequence X ∈ R L×d , where L is equal to H × W. After that, it is fed into N Transformer encoder layers for processing.Finally, the output E ∈ R L×d is fed into a head to predict Kkeypoint heatmaps P ∈ R K×H * ×W * , where the default settings are H * , W * = HI/4 , WI/4.After obtaining the heatmap of the different joints, the position with the highest thermal value in the heatmap is selected to obtain the joints' coordinates.

Transformer encoder layer after twin attention is introduced
The self-attention mechanism, as the core of the transformer, has received a lot of attention for its excellent modeling ability for the connection between long-range features 24 .Along with the excellent global modeling ability of self-attention, there is also a large consumption of computational resources due to its complex matrix operations.Therefore, to alleviate this problem, this paper introduces the twin attention mechanism into transformer encoders to replace the original self-attention computational mechanism and make the network more efficient and resource-friendly.

Self-attention mechanism
The self-attention mechanism, as the core of the transformer, can be further divided into single-head selfattention and multi-head self-attention according to the number of attention heads 22 .The calculation process of the single-head self-attention mechanism is as follows: first, the input sequence X ∈ R L×d is multiplied by the three weight matrices Wq, Wk, Wv ∈ R d×d , then we can get the queries, keys, values matrices Q, K, V ∈ R L×d to calculate the attention value, the schematic diagram of self-attention is depicted in Fig. 2a.
Firstly, the correlation score matrix A ∈ R L×L between each input feature x i ∈ R d in X is calculated using the dot product of vectors.This is, every vector q i ∈ R d in Q is calculated with every vector k i ∈ R d in K .Specifically in matrix form, it can be expressed in Eq. (1).
After that, all correlation scores w i ∈ R L in the result matrix A are normalized to enable the gradient stable during training, which can be expressed by Eq. ( 2).
where, dk denotes the dimension of k, whose value is d in this paper.
Finally, each w i is converted to a probability distribution between [0, 1] by the softmax function and then multiplied by the corresponding v i ∈ R d , the attention value can be obtained, and the overall calculation process can be expressed by Eq. ( 3).
where Z ∈ R L×d is the attention matrix.
The multi-head self-attention mechanism, involves processing the original input sequence through multiple sets of self-attention operations.Subsequently, the results of each set of self-attention are concatenated and subjected to a linear transformation to obtain the final output.As illustrated in Fig. 2b, it utilizes h sets of Wq , Wk , (1) www.nature.com/scientificreports/Wv to derive multiple sets of Q,K , V .Then, according to Eq. ( 3), the attention matrix is computed for each set separately.Finally, the obtained multiple matrices are concatenated 24 .Through these computations, the relationships between any two input vectors can be obtained, which helps overcome the issue of the model excessively focusing on its own position when encoding information at the current position.

Twin attention mechanism
As shown in the left side of Fig. 3, Twin attention is similar to convolution decomposition in CNN, the design idea of twin attention is to decompose the original self-attention into two steps, and then obtain a sparse representation of the original attention matrix.It first computes the attention of each column in the input matrix, while keeping the elements in different columns non-interfering with each other, and this strategy can aggregate the contextual information among the elements on the horizontal scale.After computing the attention in the column direction, a similar computation strategy is executed for each row along the row direction to obtain the  www.nature.com/scientificreports/attention of each row to establish a perfect connection between the features at the vertical scale.Connecting the attention in these two scales sequentially, a sparse representation equivalent to self-attention is obtained, which has a global receptive field with information in both horizontal and vertical dimensions and can model the global connections of the input features.
For the input two-dimensional human posture feature map X f ∈ R d×H×W , it will be decomposed into N*N patches P f ∈ R d×N×N , and then stack them in the vertical and horizontal directions respectively.To preserve the position information of the features, position embedding is added to the blocks stacked along the two directions, and the position embedding space in the column and row directions are d × 1 × N and d × N × 1 .Through this strategy, Twin attention can effectively reduce the memory consumption and computational complexity from the standard self-attention Assuming that the width and height of the input two-dimensional human pose features are 48, 64, the reduction in memory consumption and computational complexity of twin attention reaches 96% compared with the standard self-attention mechanism, which can certainly enhance the efficiency of the network greatly.

Depthwise separable convolution blocks
Considering that the sparse attentional representation may lead to the degradation of network detection performance, this paper uses two depthwise separable convolution blocks connected by leaky ReLU to replace the FFN in the original transformer encoder to enhance the feature representation capability of the network.The structure of the depthwise separable convolution block is shown in Fig. 4, which divides the traditional convolution operation into two steps.First is depthwise convolution, where one convolution kernel is responsible for only one channel, so the number of convolution kernels needed is the same as the number of input channels.After that, the generated feature maps are sent to pointwise convolution to aggregate the information on different channels.With this strategy, the depthwise separable convolution reduces the computational complexity from , so that it can provide a useful complement to the twin attention mechanism without introducing a high computational cost.where K represents the convolution kernel size, Cin represents the number of input feature channels, and Cout represents the number of output feature channels.

TransPose backbone after the introduction of V block
After the introduction of twin attention, the transformer encoder layer is significantly less resource-intensive and the efficiency of the network can be improved.However, the backbone network is not sufficient for the extraction of low and medium-level features at multiple scales.Although the HRNet as Backbone fuses features with different resolutions to obtain spatial feature information with different receptive fields through the parallel multi-subnet structure, the transition of receptive fields between different subnets is not smooth enough and the interval of receptive fields is large.For human joints with different scales, such as the nose with a smaller scale and the chest with a larger scale, the network needs a larger range and more scales of receptive fields to extract feature information at different scales 7 .Reference 25 suggests that merging features within layers with the same resolution can achieve more refined local feature representations, preserving more accurate spatial feature information, which is more conducive to precise localization of keypoints.Therefore, this paper proposes a layer-wise multi-branch feature fusion module called the V block to refine the network's receptive field spacing, increase the overall receptive field range of the network, and obtain fine representations of local features.

Backbone structure
There are two series of TransPose network backbones: ResNet-S and HRNet-S.In order to keep the high-resolution representation of the feature, HRNet-S is chosen for the study in this paper.As shown in the upper part of Fig. 4, HRNet-S mainly consists of one stem unit, three stages, and two transition units.The network can be divided into three sub-networks according to the feature map resolution, and the feature map resolutions of sub-networks 1,2,3 are gradually reduced to 1/4, 1/8, 1/16 of the input images, respectively.
The input image will be downsampled to 1/4 of the original image in the spatial size and increased in the channel dimension through the stem unit and the first stage, and then a parallel sub-network is added by doubling downsampling in each transition part.Except for the first stage which is composed of bottleneck blocks, the second and third stages are composed of one and four high-resolution modules respectively, where each high-resolution module consists of four basic blocks.Whenever the input features pass through a high-resolution module, a feature fusion operation between different subnets is performed immediately afterward.It is this design of constantly fusing different resolution features while maintaining high-resolution feature representation that www.nature.com/scientificreports/allows HRNet to perform well in various vision tasks.Note that at the end of the third stage, only the feature map of the first subnet is output, which has the highest resolution and fully fuses the features of the three different resolution subnets.

Structure of the intra-level feature fusion module V block
The proposed V block structure in this paper is shown in the black dashed box at the bottom of Fig. 5.For the third subnet of low-resolution human pose input features F in , V block first divides them into 4 branches f i (i = 1, 2, 3, 4) in the channel dimension, Then, the features of each of the four branches are fed into a 1 × 1con- volution for processing.After that, the output of each branch is processed by a 3 × 3 asymmetric convolution in turn (the asymmetric convolution structure is explained below).The output feature f i ′(i = 1, 2, 3, 4) is added to the next branch, inspired by Bi-FPN 26 , in this paper, after the forward summation is completed, a set of reverse sequential summation operations are performed, and each summation operation is followed by a 3 × 3 asym- metric convolution block to process the summed features.Output features y i (i = 1, 2, 3, 4) will be fed into a 1 × 1 convolution after concatenated, and an identity connection is employed as the HRNet Basic block.The V block is named because the arrangement of the asymmetric convolutional blocks is similar to the V in the alphabet.The V block can be expressed by the following formula: where F out represents the output feature map of a single V block, F in represents the input feature map, () represents the concation operation, and f ′ i is the feature of each branch after the first asymmetric convolution block processing, when i = 2 , let f i−2 ′ = 0 , K 1,1 represents the convolution operation using a convolution kernel of 1 × 1, and ⊙ represents the convolution operation, and K ac represents the asymmetric convolution operation using a set of convolution kernels of (3 × 1, 1 × 3).
To reduce the network's parameters and fully explore its feature extraction capabilities, this paper utilizes asymmetric convolutions in the V block instead of standard convolutions.Asymmetric convolutions decompose the standard d × d convolution into 1 × d and d × 1 convolutions, reducing the parameter count.By perform- ing convolution operations of varying degrees in different directions and positions, asymmetric convolutions can better capture subtle features and structural information in the input data, thereby enhancing the model's ( 4) Figure 5.The HRNet-S framework after V block is introduced.www.nature.com/scientificreports/understanding of the input and improving the network's perception of the local range of each keypoint.The structure is shown in Fig. 6, for the input feature f input , it will first undergo a convolution with a convolution kernel size of 3 × 1 for processing, and then send the processed features into a convolution kernel with a convolution kernel size of 1 × 3 for further feature extraction.Through this strategy, the same feature extraction effect as standard convolution can be achieved.And the number of parameters can be reduced.The asymmetric convolution processing flow can be expressed by the following formula: where ⊙ denotes the convolution, f input denotes the input feature map, f ac denotes the output feature map, and K i,j denotes the convolution operation with the size of the kernel i × j.

The receptive field analysis
In the literature 7 , it is pointed out that a larger range, as well as more scales of receptive fields, are essential to extract feature information at different scales, so in this paper, the analysis of different modules of receptive fields is carried out in this section.First, the receptive field calculation can be expressed by the following equation.
where l k represents the receptive field of the k th layer, f k denotes the kernel size of the k th layer, s i denotes the stride of the i th layer.Since the complete structure of each network is complex and inconvenient for complete analysis and comparison, only the relative receptive fields in a single block are considered and compared in this paper.Every f k is 3 and s i is 1.Thus, Eq. ( 6) can be simplified to Eq. ( 7) The relative receptive fields of V block and the two blocks in HRNet can be calculated by using Eq. ( 7), as shown in Table 1, which shows that the proposed V block has a larger receptive field compared with the two blocks in HRNet, which is beneficial for the network to learn more semantic discriminative information and thus obtain more accurate joint localization and classification.

Experiment and result analysis
The COCO 2017 dataset is selected to train and test the improved model in this paper, and the effectiveness of this paper's model is demonstrated by comparing it with other excellent models.

COCO data set and evaluation index
The COCO 2017 dataset contains more than 200,000 images and 250,000 human instances, each labeled with the location of 17 keypoints.This dataset is widely used for tasks such as target detection, human pose estimation, and semantic segmentation.The COCO train2017 dataset is used to train the proposed model in this paper, which includes 57K images and 150K human instances.The model of this paper is evaluated on the val2017 set and the test-dev2017 set, where the val2017 set contains 5000 images and the test-dev2017 set contains 20K images.This paper uses AP (average precision), AR (average recall), Params(parameter), and FLOPs (floating point operations) to evaluate networks.
Assessment is based on object keypoint similarity (OKS) in the node detection task of the COCO dataset.OKS represents how close the predicted key points are to the actual situation, and a higher OKS score means a (5) Table 1.The receptive field comparison between V block and the block in HRNet.www.nature.com/scientificreports/higher overlap between the predicted key points and the actual situation, that is, the prediction is more accurate.The calculation method is shown in Eq. ( 8).
where d i is the Euclidean distance between the i th prediction key point and the generalized truth value; S rep- resents the scaling factor, σ represents the normalization factor of the i key point; v i is the visibility parameter of the ith key point.v i is 0 when the key point does not exist, 1 when the key point exists but is blocked, and 2 when the key point exists and is visible.The function of δ is to select the key point of existence, which has two values.When v i >0, the value is 1, otherwise it is 0; N represents the number of key points, which in COCO is 17.This paper uses the standard average precision (AP) value based on OKS as an evaluation indicator.AP can be used to evaluate the network's ability to detect key points.The higher the value, the better the detection performance.AP is calculated as shown in Eq. ( 9).
where, T is the threshold set when calculating AP; δ i is used to determine the relationship between the OKS score of the i′th individual and the size of threshold T .If OKS > T is met, δ i is set to 1, otherwise it is set to 0. M is the number of human instances in the test set.

Training details
This paper follows a top-down paradigm for human pose estimation.The training samples are single human images after cropping.All input images will be resized to resolution.In this paper, we use the same data expansion, human detection results, and coordinate decoding strategy as in 17 .In this paper, the Adam optimizer is used to train the model with a training period of 240 epochs, the batch size is set to 16.The cosine annealing learning rate decay is used to change the learning rate from 0.0001 to 0.00001.The environment configuration for network training is shown in Table 2.

VTTranspose pose estimation effect test
Figure 6 shows the display image of the human pose estimation results of VTTransPose.Figure 7a-d show the pose estimation results on four images selected in COCO val2017, and Fig. 7e-h show the pose estimation results on the images taken in the actual scene.It can be observed that VTTransPose has good pose estimation results in different human scales, different human postures, and with slight occlusion, but the results are not good when dealing with large occlusion and human overlap, for example, the pose estimation results of two farther overlapping human bodies at the corner of the stairs in Fig. 7g.

Validation results on the COCO val2017 and the COCO test-dev2017 datasets
In this paper, VTTranspose's ability to complete the node detection task is tested respectively on two data sets of COCO val2017 and COCO test-DEV2017, and the test results are shown in Tables 3 and 4 respectively.
Compared to transpose-H-S.Compared to models such as HRNet-W48, TokenPose, GTPose, TransPose-H-A4, and TransPose-H-A6, although VTTransPose may have slightly lower AP, its parameter count and computational complexity are only 1/10 to 1/2 of these models.Compared to other models in the table, VTTransPose achieves higher accuracy with lower parameter counts and computational complexity.
On the COCO test-dev2017 dataset, all models are evaluated based on the object detection results obtained from the same human object detector achieving 60.9 AP.As shown in Table 4, among models with the same input size, the proposed VTTranspose achieves competitive performance with 73.6 AP while having the fewest parameters and the lowest computational complexity.

Ablations
In order to verify the respective effects of two improvement modules in VTTransPose, the following experiments were carried out on COCO val2017.Firstly, only introduce the improved transformer encoder layer to the original TransPose, then train the model and test its network performance.On this basis, V block is introduced to Backbone and network performance is detected after training.The results are shown in Table 5.
As can be seen from Table 5, firstly, after twin attention is introduced based on the original TransPose model, the memory occupied during the model training decreases significantly, with a decrease ratio of 44.2%, which greatly improves the training efficiency; and due to the addition of depthwise separable convolution, the feature extraction ability of the model is enhanced, and the AP index is improved compared with the original model by 0.2.After that, the AP index is improved by 0.2 with the introduction of V block, which slightly increases the memory consumption, but reduces the number of model parameters by 25% with the introduction of asymmetric convolution, so that the model achieves a balance of accuracy and the number of parameters.

Conclusion
This paper presents a top-down human pose estimation model VTTransPose.First, to reduce the computational complexity of self-attention in the transformer, save computational resources, and speed up the training and convergence process, the self-attention in the original TransPose network is replaced by the twin attention computing mechanism, which can reduce the memory and computational complexity from O((H*W)2) to  ).And the depthwise separable convolution is added after twin attention to replace the MLP module to enhance the local feature capture capability with a very small amount of computation.Later, to enhance the feature extraction ability and expression ability of the model for the fine-grained task of keypoint detection, the intra-level feature fusion module V block was introduced into the third subnet of HRNet-S in TransPose to achieve intra-level feature and inter-level feature fusion of the network.In addition, to enhance the feature extraction capability of the network while reducing the number of parameters, the standard convolution within the V block is replaced with an asymmetric convolution, and the number of parameters is reduced by such convolutional decomposition without reducing the accuracy.The validation results on COCO val2017 and COCO test-dev2017 datasets show that VTTransPose has lower memory consumption, higher training efficiency, and higher accuracy compared with the original model.The proposed model also has a competitive performance when compared with other good models.
Although the comprehensive performance of the model proposed in this paper is good, the limitation to the inherent CNN-Transformer fusion framework leads us to make only small improvements in various aspects and does not reach SOTA.Therefore, in the future, we will make a study on how to better fuse CNN and transformer architectures in pose estimation tasks.

Table 3 .
Comparisons on the COCO validation set.

Table 4 .
Comparisons on the COCO test-dev set.

Table 5 .
Ablation study on the two improvement modules.